package com.ssd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssd.entity.OrderEntity;
import com.ssd.vo.CollectBillVO;
import com.ssd.vo.CollectOrderVO;
import com.ssd.vo.RegionTotalVO;
import com.ssd.vo.SkuSeniority;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<OrderEntity> {

    /**
     * 查询某个商圈内销量前十的商品skuId
     *
     * @param businessId
     * @return
     */
    public List<Long> getTop10Sku(@Param("businessId") Integer businessId);

    /**
     * 根据地区汇总销售额数据
     *
     * @param start
     * @param end
     * @return
     */
    public List<RegionTotalVO> getCollectByRegion(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("payStatus") Integer payStatus);

    /**
     * 指定时间段的销售总额
     *
     * @param start
     * @param end
     * @return
     */
    public Integer getTotalAmount(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("status") Integer status);

    /**
     * 指定时间段的订单数量
     *
     * @param start
     * @param end
     * @return
     */
    Integer getOrderCount(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("status") Integer status);

    public String getOrderNoByTransactionId(@Param("transactionId") String transactionId);

    /**
     * 查询商品销售排行
     * @param start
     * @param end
     * @return
     */
    public List<SkuSeniority> getSkuSeniority(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("status") Integer status);

    /**
     * 查询每月的销售趋势
     * @param start
     * @param end
     * @param status
     * @return
     */
    List<CollectBillVO> getAmountCollect(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("status") Integer status);

    /**
     * 指定时间段的订单数量
     * @param start
     * @param end
     * @return
     */
    List<CollectOrderVO> getOrderCollect(@Param("start") LocalDate start, @Param("end") LocalDate end, @Param("status") Integer status);

}

